<?php
    require_once('../code/global.php');
    require_once('/code/Category.php');
    require_once('/code/Admin.php');
    $admin=new Admin();
    $admin->loginCheck(1);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <title>PhotoFromThe1st 后台管理系统</title>
        <link rel="stylesheet" href="/styles/admin.css" type="text/css" media="all">
        <script type="text/javascript" src="/script/jquery-1.6.1.min.js"></script>
        <script type="text/javascript" src="/script/script.js"></script>
    </head>
    <body>
        <?php
            if(isset($_GET['msg'])) echo '<div class="msgBox">'.$_GET['msg'].'</div>';
            else echo '<div class="msgBox">上传照片。</div>';
        ?>
        <form name="addPhoto" action="exec.php" method="post" enctype="multipart/form-data">
            <input type="hidden" name="action" value="addPhoto"><input type="hidden" name="max_file_size" value="10000000">
            <table border="0" cellspacing="0" cellpadding="0" class="detailTable">
                <tr class="seperator"><td colspan="2"></td></tr>
                <tr><td>Category:</td><td>
                        <select name="category_id">
                            <?php
                                $category=new Category();
                                $c=$category->getCategories(0);
                                $c_count=count($c);
                                $i=0;
                                while($i<$c_count){
                                    echo '<option value="'.$c[$i]['category_id'].'"'.($c[$i]['category_id']==$p['category_id']?' selected':'').'>'.$c[$i]['name'].'</option>';
                                    ++$i;
                                }
                            ?>
                        </select>
                    </td></tr>
                <tr><td>Select Photo:</td><td><input type="file" name="imgFile"></td></tr>
                <tr class="seperator"><td colspan="2"></td></tr>
                <tr><td colspan="2" class="align-center"><input class="btnLnk" type="submit" name="add" value="Upload Photo"><input class="btnLnk" type="button" name="cancel" value="Cancel" onclick="location.href='photo.php'"></td></tr>
            </table>
        </form>
    </body>
</html>